﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Microformats.Controls;
using System.ComponentModel;
using System.Web.UI;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Web;
using System.Web.UI.WebControls;
using Microformats.Enums;

namespace Microformats.Controls
{
    public class IMPP : Messaging
    {
        public IMPPType Type { get; set; }
        public string InstantMessageName { get; set; }

        public override void Render(ref HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "url");

            switch (Type)
            {
                case IMPPType.AIM:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("aim:goim?screenname={0}", InstantMessageName));
                    writer.RenderBeginTag(HtmlTag);
                    writer.Write("AIM");
                    break;
                case IMPPType.Yahoo:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("ymsgr:sendIM?{0}", InstantMessageName));
                    writer.RenderBeginTag(HtmlTag);
                    writer.Write("Yahoo");
                    break;
                case IMPPType.MSN:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("msnim:chat?contact={0}", InstantMessageName));
                    writer.RenderBeginTag(HtmlTag);
                    writer.Write("MSN");
                    break;
                default:
                    break;
            }
            
            writer.RenderEndTag();
        }
    }
}
